{% extends "djips/common/base.html" %}
{% load djips_extras %}
{% load i18n %}

{% block title %}
{% trans "Manage translations" %}
{% endblock %}

{% block content %}

{% if success %}
<p class="info_msg">{% trans "Translations have been updated" %}</p>
{% endif %}

<form name="manage_translations_form"
      class="enableFormTabbing"
      action="{{admin_base_url}}/djips_common/translations/"
      method="POST">

<fieldset class="tabbed" id="fieldset-colors">
  <legend id="fieldsetlegend-colors">{% trans "Categories" %}</legend>
  <table class="listing">
    <thead>
      <tr>
	{% for lang in langs %}
	<th>{{lang.name}}</th>
	{% endfor %}
      </tr>
    </thead>
    <tbody>
      {% for color in colors %}
      <tr class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}">
	{% for lang in langs %}
	<td><input type="text"
	           name="color_{{color.id}}_{{lang.id}}"
	           value="{{color|djips_dynamic_key:lang.id}}" />
	</td>
	{% endfor%}
      </tr>
      {% endfor%}
    </tbody>
  </table>
</fieldset>

<fieldset class="tabbed" id="fieldset-tags">
  <legend id="fieldsetlegend-tags">{% trans "Tags" %}</legend>
  <table class="listing">
    <thead>
      <tr>
	<th></th>
	{% for lang in langs %}
	<th>{{lang.name}}</th>
	{% endfor %}
      </tr>
    </thead>
    <tbody>
      {% for tag in tags %}
      <tr class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}">
	<td class="left">	  
	  {% for ancestor in tag.ancestors%}-{% endfor %} {{tag.default_name}}
	</td>
	{% for lang in langs %}
	<td><input type="text"
	           name="tag_{{tag.id}}_{{lang.id}}"
	           value="{{tag|djips_dynamic_key:lang.id}}" />
	</td>
	{% endfor%}
      </tr>
      {% endfor%}
    </tbody>
  </table>
</fieldset>
  
  <div class="center">
  <input type="submit"
         class="valid"
         value="{% trans "Update translations" %}" />
  </div>
</form>  
{% endblock %}
